package com.woniuxy01;

/**
 * @author 作者
 * @create 2025-09-05 14:45
 * 封装动物园的饲养员
 */
public class Feeder {
      //方法重载：扩展麻烦
//    public void feed(Cat cat) {
//        cat.eat();
//    }
//    public void feed(Dog dog) {
//        dog.eat();
//    }
    public void feed(Animal animal ) {
        animal.eat();
    }

    public void play(Animal animal ) {
        if (animal instanceof Cat) {
            Cat cat = (Cat) animal;
            cat.playBall();
        }else if (animal instanceof Dog) {
            Dog dog = (Dog) animal;
            dog.catchDisc();
        }
    }


}
